﻿using System;

namespace Wulong.Phone.Dianping.Utils
{
    public class AnonymousObservable<T> : IObservable<T>
    {
        private readonly Func<IObserver<T>, IDisposable> _subscribeAction;
        public AnonymousObservable(Func<IObserver<T>, IDisposable> subscribeAction)
        {
            _subscribeAction = subscribeAction;
        }
        public IDisposable Subscribe(IObserver<T> observer)
        {
            return _subscribeAction(observer);
        }
    }
}
